package com.awn.weidian.demo.controller;



import com.awn.weidian.demo.mapper.IGoods;
import  com.awn.weidian.demo.pojo.Goods;
import com.awn.weidian.demo.service.DateHandle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/api/")
public class GoodsController {

    @Autowired
    private IGoods ig;



    @GetMapping("/show")
    public List<Goods> showGoods(Goods goods ){
        return ig.showList();
    }

    @GetMapping("/showState/{state}")
    public List<Goods> showState(Goods goods ,@PathVariable int state){
        return ig.showState(state);
    }

    @GetMapping("/selectState/{shopdele}")
    public List<Goods> selectState(Goods goods ,@PathVariable int shopdele){
        return ig.selectState(shopdele);
    }

    @PostMapping("/updateGoods")
    public int updateUser(@RequestBody  Goods goods){
        return ig.update(goods);
    }

    @PostMapping("/addGoods")

    public int addGoods(@RequestBody Goods goods){
        return ig.addGoods(goods);
    }
}
